﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AncientLand.Service;
using AncientLand.Service.Entity;
using AncientLand.Service.IDa;

namespace AncientLand.Da
{
    public class CommitChange : ICommit
    {
        private readonly IDatabaseFactory _databaseFactory;
        private SiteDb _dataContext;

        public CommitChange(IDatabaseFactory databaseFactory)
        {
            this._databaseFactory = databaseFactory;
        }

        protected SiteDb DataContext
        {
            get { return _dataContext ?? (_dataContext = _databaseFactory.Get()); }
        }

        public void Commit()
        {
            DataContext.Commit();
        }
    }
}
